package code.part02_objectOriented;

import org.junit.jupiter.api.Test;

/**
 * @author: ZJT
 * @Time: 2021/7/11
 * @Description: 多态
 */
public class P11_Polymorphic {


    @Test
    public void run(){

        P10_Interface dog = new Dog();
        dog.eat();
        P10_Interface cat = new Cat();
        cat.eat();

    }


    class Dog implements P10_Interface{

        @Override
        public void eat() {
            System.out.println("狗吃肉");
        }
    }

    class Cat implements P10_Interface{

        @Override
        public void eat() {
            System.out.println("猫吃鱼");
        }
    }
}
